package com.adwin.addcoin.ui.adapter

import android.content.Context
import android.graphics.Color
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.Adapter
import androidx.recyclerview.widget.RecyclerView.ViewHolder
import com.adwin.addcoin.R
import com.adwin.addcoin.databinding.HomeTaskItemBinding
import com.adwin.addcoin.repository.bean.HomeTaskBean
import com.adwin.addcoin.ui.task.TaskDetailActivity
import com.adwin.addcoin.ui.viewholder.CheckInHolder
import com.adwin.addcoin.ui.viewholder.NewbieMissionHolder
import com.adwin.addcoin.ui.viewholder.TaskItemHolder
import com.bumptech.glide.Glide

class NewbieMissionAdapter(val tasks:List<HomeTaskBean>, val mContext:Context) : Adapter<NewbieMissionHolder>() {
    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): NewbieMissionHolder {
        val view = LayoutInflater.from(mContext).inflate(R.layout.newbie_mission_item_layout,parent,false)
        return NewbieMissionHolder(view)
    }

    override fun getItemCount(): Int = tasks.size

    override fun onBindViewHolder(holder: NewbieMissionHolder, position: Int) {
        val bean = tasks[position]
        holder.upDateTask(bean)
        holder.view.setOnClickListener {
            TaskDetailActivity.start(mContext,"",bean.activityId,bean.appName?:"",bean.description?:"",bean.taskType)
        }
    }
}